package com.luther.design.singleton;

/**
 * 懒汉式(线程安全)
 * <h3>Description</h3>
 * TODO
 * <h3>Author</h3> luzhenbang
 * <h3>Date</h3> 03/04/2018 12:51
 * <h3>Copyright</h3> Copyright (c)2018 Shenzhen TL  Co., Ltd. Inc. All rights reserved.
 */
public class SingletonLazySyn {

    private static SingletonLazySyn singleton  = null ;

    /**
     * 构造方法私有化
     * */
    private SingletonLazySyn(){

    }

    /**
     * 使用关键字synchronized 锁方法
     * @return
     */
    public static synchronized SingletonLazySyn getInstance() {
        if (null == singleton){
            singleton = new SingletonLazySyn();
        }
        return singleton;
    }
}
